package com.situ.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.situ.utils.AuditEntity;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;
import java.util.List;

/**
 * 商品模型
 */

@Getter
@Setter
@TableName("product")
public class Product extends AuditEntity {
    @TableId(type = IdType.AUTO)
    private Integer id; //商品ID

    private Integer categoryId; //商品分类ID

    private String name; //商品名称

    private BigDecimal price; //商品原价

    private Integer stock; //商品库存

    private String description; //商品描述

    private String coverImage; //商品封面图片

    @TableField(typeHandler = JacksonTypeHandler.class)
    private List<ImageUrl> detailImages; //商品详情图片

    private Integer isSeckill; //是否秒杀商品 (1：是  0：否)

    private Integer isOnSale; //是否上架 (1：是  0：否)

    @TableField(exist = false)
    private ProductCategory productCategory; //商品分类
}
